﻿
@{
    Layout = null;
}

<html class="loginHtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>孤独的旅行家</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <link href="~/Content/css/login.css" rel="stylesheet" />
    <style type="text/css">
        .loginTip {
            height: 50px;
            width: 260px;
            padding: 20px;
            border-radius: 4px;
            position: absolute;
            left: 50%;
            top: 85%;
            margin: -150px 0 0 -150px;
            z-index: 99;
        }

        .layui-form-checkbox span {
            height: 20px;
        }

        .loginTip span {
            text-align: center;
            color: #fff;
            font-size: 20px;
        }
    </style>
</head>
<body>
    <div id="bg-body"><img id="bg-body0" src="~/Content/layui/images/chun.jpg" alt="Full screen background image" style="display: none;"><img id="bg-body1" src="~/Content/layui/images/xia.jpg" alt="Full screen background image" style="display: inline-block;"><img id="bg-body2" src="~/Content/layui/images/qiu.jpg" alt="Full screen background image" style="display: none;"><img id="bg-body3" src="~/Content/layui/images/dong.jpg" alt="Full screen background image" style="display: none;"></div>
    <div class="login">
        <h1>孤独的旅行家</h1>
        <form class="layui-form" action="#" method="post">
            <div class="layui-form-item">
                <input class="layui-input" name="UserAccount" placeholder="用户账号" lay-verify="required" type="text" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <input class="layui-input" name="UserPassWd" placeholder="密码" lay-verify="required" type="password" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <input type="checkbox" name="rememberMe" value="true" lay-skin="primary" checked="" title="记住帐号?">
                <div class="layui-unselect layui-form-checkbox layui-form-checked" lay-skin="primary">
                    <span>记住帐号?</span><i class="layui-icon"></i>
                </div>
            </div>
            <button class="layui-btn login_btn" type="button" lay-filter="*" lay-submit>登录</button>
        </form>
    </div>
    <div class="loginTip">
      
    </div>
    <script src="~/Content/layui/layui.js"></script>
    <script src="~/Content/js/jquery.min.js"></script>
    <script src="~/Content/js/jquery.bcat.bgswitcher.js"></script>
    <script>
        layui.use(['layer', 'form'], function () {
            var layer = layui.layer,
                $ = layui.jquery,
                form = layui.form;
            $(document).ready(function () {
                var srcBgArray = ["/Content/layui/images/chun.jpg",
                    "/Content/layui/images/xia.jpg",
                    "/Content/layui/images/qiu.jpg",
                    "/Content/layui/images/dong.jpg"];
                $('#bg-body').bcatBGSwitcher({
                    timeout: 5000,
                    urls: srcBgArray,
                    alt: 'Full screen background image'
                });
            });

            $("#mycode").on('click', function () {
                var t = Math.random();
                $("#mycode")[0].src = "/genCaptcha?t= " + t;
            });
            //上传接口
            layui.use(['jquery', 'form'], function () {
                var $ = layui.jquery, form = layui.form;
                //提交事件触发
                form.on('submit(*)', function (data) {
                    //登陆
                    $.ajax({
                        type: "post",
                        url: "/Admin/AdminLogin/Login",
                        data: data.field,
                        dataType: "json",
                        success: function (res) {
                            if (res.code == 0) {
                                layer.msg(res.msg, { icon: 1 });
                                window.location.href = '/Admin/AdminHome/Index';
                            }
                            else {
                                layer.msg(res.msg, { icon: 2 });
                            }
                        }
                    });
                    return false;
                });
            });
            form.on('submit(login)', function (data) {
                var loadIndex = layer.load(2, {
                    shade: [0.3, '#333']
                });
                if ($('form').find('input[type="checkbox"]')[0].checked) {
                    data.field.rememberMe = true;
                } else {
                    data.field.rememberMe = false;
                }
                $.post(data.form.action, data.field, function (res) {
                    layer.close(loadIndex);
                    if (res.success) {
                        location.href = "/" + res.data.url;
                    } else {
                        layer.msg(res.message);
                        $("#mycode").click();
                    }
                });
                return false;
            });
        });</script>
</body>
</html>
